<?php

class delivery_type
{

	private $delivery_name;
	private $box_weight;
	private $service_charge;
	private $detail;
	private $showStatus;
	
        
        function  set($dn,$bw,$sc,$cm,$sh)
        {
        
        $this->delivery_name=addslashes(strip_tags(trim($dn)));
        $this->box_weight=trim($bw);
        $this->service_charge=trim($sc);
        $this->detail=addslashes(strip_tags(trim($cm)));
		$this->showStatus=$sh;
        }
       
        
        function  insert()
        {
            if(!empty($this->delivery_name) && isset($this->box_weight) && isset($this->service_charge))
            {
                $sql="INSERT INTO sme_delivery_type
                     VALUES (null,'$this->delivery_name',$this->box_weight,$this->service_charge,'$this->detail',$this->showStatus)";
                return mysql_query( $sql );
            }else  return FALSE;

        }
		function delete($del)
		{
			$sql="DELETE FROM sme_delivery_type WHERE  sme_delivery_type.delivery_Id ='$del'";
			mysql_query( $sql );
		}
		function update($up)
		{
			
			$sql="UPDATE sme_delivery_type 
			SET delivery_name = '$this->delivery_name',
			box_weight = '$this->box_weight',
			service_charge = '$this->service_charge',
			detail ='$this->detail',
			showStatus ='$this->showStatus'
			WHERE delivery_Id =$up ";
			return mysql_query( $sql );
		}
		function showstt($id,$ac)
		{
			
			$sql="UPDATE sme_delivery_type 
			SET showStatus ='$ac'
			WHERE delivery_Id =$id ";
			
			return mysql_query( $sql );
                   
		}
        function check_non_unique($str)
        {
            $sql="SELECT delivery_id  FROM sme_delivery_type WHERE  delivery_name='$str' ";
            $recordSql = mysql_query ( $sql);
            $record=mysql_num_rows($recordSql);
			if($record<1)  return TRUE;
            else return FALSE;
        }
}

?>